<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        
        let arr1 = [2, 6, 52, 10, 77, 25, 62, 7];
        console.log(arr1);
        function sort(arr) {
            for (let j = 0; j < arr.length - 1; j++) {
                for (let i = 0; i < arr.length - 1 - j; i++) {
                    if (arr[i] > arr[i + 1]) {
                        let temp = arr[i];
                        arr[i] = arr[i + 1];
                        arr[i + 1] = temp;
                    }
                }

            }
        }
        sort(arr1);

        console.log(arr1);

        // 冒泡排序 : 依次比较两个相邻的元素，大的放后面

    </script>
</body>

</html>